import Vue from 'vue'
import VueRouter from 'vue-router'
import discover from '@/pages/discover'
import friend from '@/pages/friend'

Vue.use(VueRouter)

let routes = [
  {
    path: '/discover',
    // 路由重定向
    redirect: '/discover/djradio',
    component: discover,
    children: [
      {
        path: 'playlist',
        component: () => import('@/pages/discover/playlist'),
      },
      {
        path: 'djradio',
        component: () => import('@/pages/discover/djradio'),
      },
    ],
  },
  {
    path: '/friend/:wq',
    component: friend,
  },
  {
    path: '/mine',
    component: () => import(/*webpackChunkName:'mine'*/ '@/pages/mine'),
  },
  {
    path: '/list',
    component: () => import('@/pages/list'),
  },
  {
    path: '/detail/:productid',
    props: true,
    component: () => import('@/pages/detail'),
  },
  {
    path: '*',
    component: () => import('@/pages/page404'),
  },
]

let router = new VueRouter({
  routes,
})

export default router
